package com.wj.rpsm.admin.mapper;

import com.github.pagehelper.Page;
import com.wj.rpsm.admin.pojo.Floor;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

/**
 * @author WeiJin
 * @version 1.0
 */
@Repository
public interface FloorMapper {

    @Select("<script>" +
            "select * from floor " +
            "<where>" +
            "<if test='number != null and number != \"\"'>" +
            "floor_number like concat('%',#{number},'%')" +
            "</if>" +
            "</where>" +
            "</script>")
    Page<Floor> findAllFloor(@Param("number") String number);


    /**
     * 根据楼层编号查询楼层号，所属楼栋
     * @param floorId
     * @return
     */
    @Select("select floor_id,belong_building,floor_number from floor where floor_id = #{id}")
    Floor queryById(Integer floorId);
}
